﻿namespace HRM.CORE
{

    using APP.HELPER.Data.Helper;
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;

    public class HRM_WORK_EMPLOYEE
    {
        private string m_EmployeeCode;
        private Guid m_WorkID;

        public HRM_WORK_EMPLOYEE()
        {
            this.m_WorkID = Guid.Empty;
            this.m_EmployeeCode = "";
        }

        public HRM_WORK_EMPLOYEE(Guid WorkID, string EmployeeCode)
        {
            this.m_WorkID = WorkID;
            this.m_EmployeeCode = EmployeeCode;
        }

        public string Delete()
        {
            string[] myParams = new string[] { "@WorkID" };
            object[] myValues = new object[] { this.m_WorkID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_WORK_EMPLOYEE_Delete", myParams, myValues);
        }

        public string Delete(Guid WorkID, string EmployeeCode)
        {
            string[] myParams = new string[] { "@WorkID", "@EmployeeCode" };
            object[] myValues = new object[] { WorkID, EmployeeCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_WORK_EMPLOYEE_Delete", myParams, myValues);
        }

        public string Delete(SqlConnection myConnection, Guid WorkID, string EmployeeCode)
        {
            string[] myParams = new string[] { "@WorkID", "@EmployeeCode" };
            object[] myValues = new object[] { WorkID, EmployeeCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myConnection, "HRM_WORK_EMPLOYEE_Delete", myParams, myValues);
        }

        public string Delete(SqlTransaction myTransaction, Guid WorkID, string EmployeeCode)
        {
            string[] myParams = new string[] { "@WorkID", "@EmployeeCode" };
            object[] myValues = new object[] { WorkID, EmployeeCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_WORK_EMPLOYEE_Delete", myParams, myValues);
        }

        public bool Exist(Guid WorkID, string EmployeeCode)
        {
            bool hasRows = false;
            string[] myParams = new string[] { "@WorkID", "@EmployeeCode" };
            object[] myValues = new object[] { WorkID, EmployeeCode };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader("HRM_WORK_EMPLOYEE_Get", myParams, myValues);
            if (reader != null)
            {
                hasRows = reader.HasRows;
                reader.Close();
                helper.Close();
                reader = null;
            }
            return hasRows;
        }

        public DataTable GetList(Guid WorkID)
        {
            string[] myParams = new string[] { "@WorkID" };
            object[] myValues = new object[] { WorkID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_WORK_EMPLOYEE_GetList", myParams, myValues);
        }

        public string Insert()
        {
            string[] myParams = new string[] { "@WorkID", "@EmployeeCode" };
            object[] myValues = new object[] { this.m_WorkID, this.m_EmployeeCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_WORK_EMPLOYEE_Insert", myParams, myValues);
        }

        public string Insert(SqlTransaction myTransaction)
        {
            string[] myParams = new string[] { "@WorkID", "@EmployeeCode" };
            object[] myValues = new object[] { this.m_WorkID, this.m_EmployeeCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_WORK_EMPLOYEE_Insert", myParams, myValues);
        }

        public string Insert(Guid WorkID, string EmployeeCode)
        {
            string[] myParams = new string[] { "@WorkID", "@EmployeeCode" };
            object[] myValues = new object[] { WorkID, EmployeeCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_WORK_EMPLOYEE_Insert", myParams, myValues);
        }

        public string Insert(SqlConnection myConnection, Guid WorkID, string EmployeeCode)
        {
            string[] myParams = new string[] { "@WorkID", "@EmployeeCode" };
            object[] myValues = new object[] { WorkID, EmployeeCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myConnection, "HRM_WORK_EMPLOYEE_Insert", myParams, myValues);
        }

        public string Insert(SqlTransaction myTransaction, Guid WorkID, string EmployeeCode)
        {
            string[] myParams = new string[] { "@WorkID", "@EmployeeCode" };
            object[] myValues = new object[] { WorkID, EmployeeCode };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_WORK_EMPLOYEE_Insert", myParams, myValues);
        }

        [DisplayName("EmployeeCode"), Category("Column")]
        public string EmployeeCode
        {
            get
            {
                return this.m_EmployeeCode;
            }
            set
            {
                this.m_EmployeeCode = value;
            }
        }

        public string ProductName
        {
            get
            {
                return "Class HRM_WORK_EMPLOYEE";
            }
        }

        public string ProductVersion
        {
            get
            {
                return "1.0.0.0";
            }
        }

        [Category("Primary Key"), DisplayName("WorkID")]
        public Guid WorkID
        {
            get
            {
                return this.m_WorkID;
            }
            set
            {
                this.m_WorkID = value;
            }
        }
    }
}

